﻿<%@ Page Title="Chat Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Channel.aspx.cs" Inherits="ChatASP.Channel" %>

    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <asp:ScriptManager ID="ScriptManager" runat="server" />
        
        <asp:UpdatePanel runat='server' ID='ChatUpdatePanelTime' UpdateMode="Conditional">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="TimerTimeRefresh" EventName="Tick" />
            </Triggers>
            <ContentTemplate>
                <asp:ListView ID="MessageList" runat="server">
                    <ItemTemplate>
                        <asp:Label Text='<%# Eval("Text") %>' runat="server" /><br />
                    </ItemTemplate>
                </asp:ListView>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:Timer ID="TimerTimeRefresh" runat="Server" Interval="500" />  
        <asp:TextBox ID="ChatText" runat="server" />
        <asp:Button ID="ChatButton" runat="server" Text="Enter" 
            onclick="ChatButton_Click" />

        <br />
        <asp:UpdatePanel runat='server' ID='PrivateChatUpdatePanel' UpdateMode="Conditional">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="TimerTimeRefresh" EventName="Tick" />
            </Triggers>
            <ContentTemplate>
                <asp:ListView ID="UsersList" runat="server">
                    <ItemTemplate>
                        <asp:Label Text='<%# Eval("UserName") %>' runat="server" />
                        <asp:LinkButton ID="MessageUserButton" runat="server" 
                            Text="Message" CommandName="Message" OnClick="MessageUser"/>
                        <br />
                    </ItemTemplate>
                </asp:ListView>
                <asp:ListView ID="UserMessageList" runat="server">
                    <ItemTemplate>
                        <asp:Label Text='<%# Eval("Text") %>' runat="server" /><br />
                    </ItemTemplate>
                </asp:ListView>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:TextBox ID="UserChatText" runat="server" Visible="true"/>
        <asp:Button ID="UserChatButton" runat="server" Text="Message" 
            onclick="UserChatButton_Click" Visible="true" />
    </asp:Content>
